import {create} from 'zustand';
import {IStoreProps} from '.';

interface ISystemState {
  lang: string;
}

const useSystemStore = create<IStoreProps<ISystemState>>(set => ({
  state: {
    lang: 'zh-cn',
  },
  updateState: (newState: Partial<ISystemState>) =>
    set(store => ({state: {...store.state, ...newState}})),
  removeAllState: () =>
    set({
      state: {
        lang: '',
      },
    }),
}));

export default useSystemStore;
